#include <stdio.h>
#include <stdlib.h>

#define BUFFSIZE (1024)

void usage(void) { printf("Usage:...\n"); }

int main(int argc, char **argv) {
    if(argc != 2){ fprintf(stderr, "argc != 2\n"); usage(); exit(1); }

    FILE *fps = fopen(argv[1], "r");
    if(fps == NULL){ perror("fopen()"); exit(1); }

    fseek(fps, 0, SEEK_END); // 定位到文件尾，fseek第2参数是long(int32)，取值-2G~2G
    printf("%ld\n", ftell(fps)); // ftell返回long(int32)，所以fseek和ftell操作的文件必须小于2G
    //换成fseeko()和ftello()会好一点(但移植性不高)，编译时记得加-D_FILE_OFFSET_BITS=64，就可以修改off_t的定义

    fclose(fps);
    exit(0);
}
